#ifndef SLAVE_INFO_H
#define SLAVE_INFO_H
#include <stdint.h>
#include "ecrt.h"

typedef struct {
    bool is_supoort_dc, /**< 是否支持dc模式. */
    bool is_dc_reference_clocks, /**<是否作为参考时钟. */
    uint16_t assign_activate, /**< AssignActivate word. */
    uint32_t sync0_cycle, /**< SYNC0 cycle time [ns]. */
    int32_t sync0_shift, /**< SYNC0 shift time [ns]. */
    uint32_t sync1_cycle, /**< SYNC1 cycle time [ns]. */
    int32_t sync1_shift /**< SYNC1 shift time [ns]. */
}ec_dc_info_t;

typedef enum {
  BOOL_TYPE,
  INT8_TYPE,
  INT16_TYPE,
  INT32_TYPE,
  INT64_TYPE,
  FLOAT_TYPE,
  DOUBLE_TYPE
}ec_data_type_t;

typedef struct {
  ec_data_type_t data_type;
  uint16_t data_byte_offset;
  uint8_t data_bit_offset;
  union
  {
    bool     bool_data;
    uint8_t  int8_data;
    uint16_t int16_data;
    uint32_t int32_data;
    uint64_t int64_data;
    float   float_data;
    double   double_data;
  }data_ptr;
  
}ec_data_info_t;

// 定义从站信息结构体
typedef struct {
  uint16_t alias;                
  uint16_t postion;              
  uint32_t vendor_id;     
  uint32_t product_code;   
  ec_sync_info_t* slave_sync_info;
  ec_dc_info_t* slave_dc_info; 
  ec_data_info_t* slave_data_info;
}slave_info_t;

// 定义主站信息结构体
typedef struct {
  uint64_t period_ns;
}master_info_t;

typedef struct {
slave_info_t* slave_infos; // slave的信息，表示有多少个slave
uint16_t slave_count;   // slave的数量
ec_pdo_entry_reg_t* domain_regs; // domain的配置信息 
master_info_t* master_info; 
uint16_t master_count;   //  master的数量
}global_config_info_t;

#endif // SLAVE_INFO_H